<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
  <button v-on:click="sayHi" type="button">点击</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script>
  var vm = new Vue({
    el: "#app",
    data: {message: "Hi,Vue!"},
    // 方法必须定义在vue的methods对象中
    methods: {
      sayHi: function (){
        alert(this.message)
      }
    }
  })
</script>
</body>
</html>